/*
 * @Description:
 * @Author:  zhangweigang
 * @Date: 2021-02-14 20:08:04
 * @LastEditTime: 2021-04-03 21:32:01
 * @LastEditors: zhangweigang
 */

import Vue from 'vue';
import App from './App.vue';
import router from './router';

import 'nprogress/nprogress.css';
import './plugins/element.js';

// 注册全局组件
import Header from '@/views/header/Header.vue';
import Footer from '@/views/footer/Footer.vue';
import CurrLocat from '@/common/CurrentLocation.vue';
Vue.component('Header', Header);
Vue.component('Footer', Footer);
Vue.component('curr-locat', CurrLocat);
// Vue 实例可以作为事件总线
Vue.prototype.$bus = new Vue();

/**
 * 设置全局过滤器
 * 使用方法：{{add_time | dateFormat}}  add_time 为时间戳
 **/
Vue.filter('dateFormat', function(valueTime) {
  let date = new Date(valueTime);
  // 时间格式 yyyy-mm-dd 时间处理
  const y = date.getFullYear();
  const m = (date.getMonth() + 1 + '').padStart(2, '0');
  const d = (date.getDate() + '').padStart(2, '0');

  const hh = (date.getHours() + '').padStart(2, '0');
  const mm = (date.getMinutes() + '').padStart(2, '0');
  const ss = (date.getSeconds() + '').padStart(2, '0');

  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`;
});
Vue.config.productionTip = false;

new Vue({
  router,
  render: (h) => h(App)
}).$mount('#app');
